<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>    
<%
	String q = request.getParameter("q");
	System.out.println(q);
	String data = "1001|张三|20|采购部,1002|李四|25|研发部,1003|王五|22|测试部,2001|周六|26|商务部,2002|XXX|24|产品部";
	String[] datas = data.split(",");
	List dataList = new ArrayList();
	for (int i=0; i<datas.length; i++) {
		if (datas[i].startsWith(q)) {
			dataList.add(datas[i]); 
		}
	}
	
	for (Iterator iter=dataList.iterator(); iter.hasNext();) {
		out.println(iter.next());
	}  
%>